package exe;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice//表示全局异常处理类
public class GloEx {
//    @ExceptionHandler(Exception.class)
//    public String exe1Handle(Exception e, Model m){
//        m.addAttribute("msg",e);
//        return "error";
//    }
    

    @ExceptionHandler(Exception.class)
    public ModelAndView ex(Exception e){
        System.out.println("这是全局异常处理。。。");
        return new ModelAndView("error","msg",e);
    }
}